<script>
  import nav from '@/router/index'
  import { checkAppUpdate } from '@/utils/tools.js'
  export default {
    onLaunch: function() {
      this.$store.dispatch('getMsgList').then(() => {
        console.log('获取数据成功')
        console.log('++++++++++++++++++++++++++++++++')
        this.$store.commit('setMsgRedDot')
      }).catch((err) => {
        console.log(err)
      })
      console.log('App Launch')
    },
    onShow: function() {
      this.$store.commit('connectSocket')
      console.log('App Show')

      // #ifdef APP-PLUS
      let args = plus.runtime.arguments
      plus.runtime.arguments = ''
      if (args) {
        // 处理args参数，如直达到某新页面等
        const path = '/' + args.split('//')[1]
        nav.to(path)
        console.log(path)
      }
      
      // 更新
      checkAppUpdate()
      
      // const screenHeight = uni.getSystemInfoSync().screenHeight
      // const screenWidth = uni.getSystemInfoSync().screenWidth
      // console.log(screenHeight)
      // const view = new plus.nativeObj.View('test',
      // 	{top: (screenHeight / 2 - 150) + 'px', left: (screenWidth / 2 - 150) + 'px', height:'300px',width: '300px', backgroundColor: '#aaffff'},
        
      // 	[
      //     {tag:'img',id:'img',src:'../../static/bless2.png',position:{top:'0px',left:'0px',width:'100%',height:'100px'}},
      //     // {tag:'rect',id:'rect',color:'#000000',position:{top:'0px',left:'0px',width:'100%',height:'100px'}},
      //     {tag:'font',id:'font',text:'原生控件',textStyles:{size:'18px'}}
      // 	]);
      // 	view.show();
      console.log(plus.push.getClientInfo())
      uni.onPushMessage((res)=>{
      	console.log(res)
      })
      // #endif
    },
    onHide: function() {
      console.log('App Hide')
    }
  }
</script>

<style lang="scss">
  /* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
  @import "@/uni_modules/uview-ui/index.scss";
  @import "@/styles/global.scss";

  page {
    box-sizing: border-box;
    // background-color: #ededed;
    height: 100%;
  }
</style>
